<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <style>
    .box {
      box-sizing: content-box;
      position: relative;
      width: 300px;
      height: 300px;
      overflow: auto;
      border: 5px solid skyblue;
      padding: 10px;
      margin: 0 40px;
      background: pink;
    }

    .content {
      position: relative;
      width: 1000px;
      height: 150px;
      background: greenyellow;
      color: #fff;
      font-size: 30px;
    }
  </style>

  <body>
    <div id="box" class="box scrollbar">
      <div class="content">
        云牧DSB云牧DSB云牧DSB云牧DSB云牧DSB云牧DSB云牧DSB云牧DSB云牧DSB云牧DSB云牧DSB云牧DSB云牧DSB云牧DSB云牧DSB云牧DSB云牧DSB云牧DSB云牧DSB云牧DSB
      </div>
    </div>
    <script>
      const box = document.getElementById("box");
      console.log("clientWidth ==", box.clientWidth);
      console.log("offsetWidth ==", box.offsetWidth);
      console.log("scrollWidth ==", box.scrollWidth);
    </script>
  </body>
</html>
